//
//  Collection+Safe.swift
//
//
//  Created by S JZ on 2024/2/1.
//

import Foundation

public extension Collection {
    // 集合类型的安全索引
    subscript (safe index: Index) -> Element? {
        return indices.contains(index) ? self[index] : nil
    }
}
